#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    bool check(int i)
    {
        string str = to_string(i);
        int n = str.size();
        if (n % 2 != 0)
            return false;
        int mid = n / 2;
        string prev = str.substr(0, mid);
        string end = str.substr(mid);
        char a = 0, b = 0;
        for (int j = 0; j < prev.size(); j++)
        {
            a += prev[j];
            b += end[j];
        }
        return a == b;
    }
    int countSymmetricIntegers(int low, int high) {
        int res = 0;
        for (int i = low; i <= high; i++)
        {
            if (check(i))
                ++res;
        }
        return res;
    }
};